package cn.hiapi.shop.query;

import cn.hiapi.basic.jpa.pageable.QueryWrapper;
import cn.hiapi.basic.jpa.query.BasicQuery;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.Sort;

/**
 * @author AdinZ
 * @date 2023/2/5 22:09
 */
@Setter
@Getter
public class ShopMessageQuery extends BasicQuery {
    private long shopId;
    @Override
    public QueryWrapper getQueryWrapper() {
        super.direction = Sort.Direction.DESC;
        if (super.properties == null || super.properties.length == 0) {
            super.properties = new String[]{"id"};
        }

        final QueryWrapper wrapper = super.getBasicQueryWrapper();
        wrapper.or(new QueryWrapper().isNull("uid").eq("uid", shopId));
        return wrapper;
    }
}
